#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e3+5;
int n,h[N],f[N*50][N],nxt[N][200];
string s,t;
signed main()
{
	freopen("neck.in","r",stdin);
	freopen("neck.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>s>>t;
	s = ' '+s;
	n = t.size(),t = ' '+t;
	for(int i = 2;i<=n;i++)
	{
		int p = h[i-1];
		while(p&&t[i]!=t[p+1]) p = h[p];
		if(t[i]==t[p+1]) h[i] = p+1;
	}
	for(int i = 0;i<n;i++)
	{
		int p = i;
		while(p)
		{
			if(!nxt[i][t[p+1]]) nxt[i][t[p+1]] = p+1;
			p = h[p];
		}
		if(!nxt[i][t[1]]) nxt[i][t[1]] = 1;
	}
	for(int i = 0;i<s.size();i++)
		for(int j = 0;j<=n;j++)
			f[i][j] = -2e9;
	f[0][0] = 0;
	for(int i = 1;i<s.size();i++)
	{
		for(int j = 0;j<=n;j++)
		{
			if(nxt[j][s[i]]!=n) f[i][nxt[j][s[i]]] = max(f[i][nxt[j][s[i]]],f[i-1][j]+1);
			f[i][j] = max(f[i][j],f[i-1][j]);
		}
	}
	int ans = 0;
	for(int i = 0;i<=n;i++) ans = max(ans,f[s.size()-1][i]);
	cout<<ans; 
	return 0;
}

